package edu.columbia.doodle.factory
{
	import com.adobe.webapis.flickr.FlickrService;
	
	import edu.columbia.doodle.flickr.Constant;
	
	import flash.utils.Dictionary;

	public class Singleton
	{
		
		private static var _instance:Singleton;
		
		private var _tags:Array = new Array();
		
		private var _photoClusters:Dictionary = new Dictionary();
		
		private var _flickrService:FlickrService = new FlickrService(Constant.API_KEY);
		
		public function Singleton()
		{
			_flickrService.secret = Constant.SECRET;
			if (_instance != null)
			{
				throw new Error("Singleton can only be accessed through Singleton.instance");
			}
		}
		
		public static function get instance():Singleton
		{
			if (_instance == null)
				_instance = new Singleton();
			
			return _instance;
		}
		
		public function get tags():Array
		{
			return _tags;
		}
		
		public function set tags(tags:Array):void
		{
			_tags = tags;
		}
		
		public function get photoClusters():Dictionary
		{
			return _photoClusters;
		}
		
		public function set photoClusters(photoClusters:Dictionary):void
		{
			_photoClusters = photoClusters;
		}
		
		public function get flickrService():FlickrService
		{
			return _flickrService;
		}
		
		public function set flickrService(flickrService:FlickrService):void
		{
			_flickrService = flickrService;
		}
	}
}